import time
import random

class IdGenerator:
    @staticmethod
    def generate_unique_id(node_type):
        """生成唯一ID：前缀 + 时间戳 + 随机数"""
        prefix = {
            'CulturalItem': 'A',
            'Artifact': 'B',
            'Caizhi': 'C',
            'Image1': 'I',
            'InstrumentGene': 'G'
        }.get(node_type, 'X')
        
        timestamp = int(time.time() * 1000)  # 毫秒级时间戳
        random_num = random.randint(1000, 9999)  # 4位随机数
        return f"{prefix}{timestamp}{random_num}"